package mallet;

//import cc.mallet.pipe.*;
//import cc.mallet.pipe.iterator.SimpleFileLineIterator;
//import cc.mallet.topics.HierarchicalLDA;
//import cc.mallet.types.InstanceList;
//import cc.mallet.util.Randoms;
//
//import java.io.IOException;
//import java.io.PrintWriter;
//import java.util.ArrayList;
//import java.util.regex.Pattern;


/**
 * Created by dell on 2016/8/1.
 */
public class mallet {

//    public static void main(String[] args) throws IOException {
//        String dir = "D:/g_data/dblp-6/";
//
//        // Begin by importing documents from text to feature sequences
//        ArrayList<Pipe> pipeList = new ArrayList<Pipe>();
//
//        // Pipes: lowercase, tokenize, remove stopwords, map to features
//        pipeList.add( new CharSequenceLowercase() );
//        pipeList.add( new CharSequence2TokenSequence(Pattern.compile("\\p{L}[\\p{L}\\p{P}]+\\p{L}")) );
//        pipeList.add(new TokenSequenceRemoveStopwords());
//        pipeList.add( new TokenSequence2FeatureSequence() );
//
//        InstanceList instances = new InstanceList (new SerialPipes(pipeList));
//
//        instances.addThruPipe(new SimpleFileLineIterator(dir+"dblp-6.data")); // data
//        InstanceList testing = null;
//
//
//        HierarchicalLDA hlda = new HierarchicalLDA();
//
//        // Set hyperparameters
//
//        hlda.setAlpha(0.1);
//        hlda.setGamma(0.1);
//        hlda.setEta(0.1);
//        int numLevels = 2; //层数
//        int numIterations = 3; //迭代次数
//
//
//        // Initialize random number generator
//
//        Randoms random  = new Randoms();
////        hlda.setTopicDisplay(10,10);
//
//
//        hlda.initialize(instances, testing, numLevels, random);
//        hlda.estimate(numIterations);
//        hlda.printNodes();
//
//        hlda.printState(new PrintWriter(dir+"result.txt"));
//    }
}
